# -*- coding = utf-8 -*-
# @Time: 2024/7/12 0:40
# @Author:Ethan
# @File:sql.py
# @Software:Pycharm
from PyQt5.QtSql import QSqlDatabase

# 创建数据库连接
db = QSqlDatabase.addDatabase('QSQLITE')
db.setDatabaseName(':memory:')

# 打开数据库
if not db.open():
    print("无法打开数据库")
else:
    print("数据库打开成功")